package edu.guet.server.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import edu.guet.server.model.StuSemester;
import edu.guet.server.service.StuSemesterService;
import edu.guet.server.utils.ResultAPI;

@RestController
@Slf4j
@RequestMapping("/stuSemester")
public class StuSemesterController {
    @Autowired
    StuSemesterService stuSemesterService;
    
    @RequestMapping("/setStuSemester")
    public ResultAPI setStuSemester(@RequestBody StuSemester stuSemester){
        return stuSemesterService.setStuSemester(stuSemester);
    }

    @RequestMapping("/deleteStuSemester")
    public ResultAPI deleteStuSemester(@RequestParam("user_id") int user_id, @RequestParam("semester_id") int semester_id){
        return stuSemesterService.deleteStuSemester(user_id, semester_id);
    }

    @RequestMapping("/findStuSemesterBySemesterId")
    public ResultAPI findStuSemester(@RequestParam("semester_id") int semester_id){
        return stuSemesterService.findStuSemesterBySemesterId(semester_id);
    }

    @RequestMapping("/updateStuSemesterForSocre")
    public ResultAPI updateStuSemesterForSocre(@RequestBody StuSemester stuSemester){
        return stuSemesterService.updateStuSemesterForSocre(stuSemester);
    }
    @PostMapping("/addperStu")
    public ResultAPI addperStu(@RequestBody StuSemester stuSemester){
        log.info("addperStu啊啊啊啊啊"+stuSemester);
        return stuSemesterService.addperStu(stuSemester);
    }
}
